Multi-Stage Programs are Generalized Arrows
نویسنده
چکیده
The lambda calculus, subject to typing restrictions, provides a syntax for the internal language of cartesian closed categories. This paper establishes a parallel result: staging annotations [? ], subject to named level restrictions, provide a syntax for the internal language of Freyd categories, which are known to be in bijective correspondence with Arrows. The connection is made by interpreting multistage type systems as indexed functors from polynomial categories to their reindexings (Definitions 16 and 17). This result applies only to multi-stage languages which are (1) homogeneous, (2) allow cross-stage persistence and (3) place no restrictions on the use of structural rules in typing derivations. Removing these restrictions and repeating the construction yields generalized arrows, of which Arrows are a particular case. A translation from well-typed multi-stage programs to single-stage GArrow terms is provided. The translation is defined by induction on the structure of the proof that the multi-stage program is well-typed, relying on information encoded in the proof’s use of structural rules (weakening, contraction, exchange, and context associativity). Metalanguage designers can now factor out the syntactic machinery of metaprogramming by providing a single translation from staging syntax into expressions of generalized arrow type. Object language providers need only implement the functions of the generalized arrow type class in point-free style. Object language users may write metaprograms over these object languages in a point-ful style, using the same binding, scoping, abstraction, and application mechanisms in both the object language and metalanguage. This paper’s principal contributions are the GArrow definition of Figures 2 and 3, the translation in Figure 5 and the category-theoretic semantics of Definition 16. An accompanying Coq proof formalizes the type system, translation procedure, and key theorems. [Copyright notice will appear here once ’preprint’ option is removed.]
منابع مشابه
Multi-Level Languages are Generalized Arrows
Multi-level languages and Arrows both facilitate metaprogramming, the act of writing a program which generates a program. The arr function required of all Arrows turns arbitrary host language expressions into guest language expressions; because of this, Arrows may be used for metaprogramming only when the guest language is a superset of the host language. This restriction is also present in mul...
متن کاملGeneralized Arrows
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission....
متن کاملHardware Design with Generalized Arrows
Instances of the GArrow type class (Figure 2) are called generalized arrows. The GArrow class generalizes Control.Arrow by allowing any type-level monoid to take the place of the cartesian product (,) and by replacing arr with the “structural” functions usually defined in terms of it. Multi-level terms with environment classifier types [TN03] may be flattened into single-level terms parameteriz...
متن کاملA Ratio-Based Efficiency Measurement for Ranking Multi-Stage Production Systems in DEA
Conventional data envelopment analysis (DEA) models are used to measure efficiency score of production systems when they are considered as black boxes and their internal relationship is ignored. This paper deals with a common special case of network systems which is called multi-stage production system and can be generalized to many organizations. A multi stage production system has some stages...
متن کاملA Novel Two-Stage Mathematical Model for Green Supplier Development
Nowadays, numerous processes of any supply chain are done by suppliers and consequently they cause a massive amount of pollution released to the nature. Hence, greening the suppliers has become a necessity. Although most of green supplier development programs need high investment, formal optimization models that address this issue are very rare. This paper mainly aims to address this prob...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- CoRR
دوره abs/1003.5954 شماره
صفحات -
تاریخ انتشار 2010